package com.haibara.codesubmiteval.constant;

/**
 * Redis Key 前缀常量
 *
 * @Author: mengyu
 * @Date: 2025/2/14
 */
public interface RedisKeyConstant {
    String userKey = "User";
    String questionKey = "Question";
    String questionNumber = "QuestionNum";
    String totalQuestionScore = "totalQuestionScore";
    String executingCodeId = "ExecutingCode";
    String userAcceptedQuestionIdsSet = "UserQuestionSet";
    String top10 = "Top10";
    String NoneValue = "None";
    String commonUserIds = "CommonUserIds";

    /**
     * 获取完整的key
     *
     * @param keys 各个key
     * @return 完整的key
     */
    static String getCompleteKey(String... keys) {
        StringBuilder stringBuilder = new StringBuilder();
        if (keys.length <= 1) {
            return keys[0];
        }
        stringBuilder.append(keys[0]);
        for (int i = 1; i < keys.length; i++) {
            stringBuilder.append(":");
            stringBuilder.append(keys[i]);
        }
        return stringBuilder.toString();
    }
}
